package abd.pr2.gui;

import java.awt.EventQueue;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.ListSelectionModel;
import javax.swing.border.EmptyBorder;

import java.awt.event.MouseAdapter;

import javax.swing.border.BevelBorder;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;

public class Interfaz extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JList list;
	private JTextPane textPane;
	private JScrollPane scrollPane;
	private JLabel lblBuscar;

	/**
	 * Launch the application.
	 */
	
	//método main
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Interfaz frame = new Interfaz();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	
	/**
	 * Create the frame.
	 */
	public Interfaz() {
		setTitle("Visor de Noticias");
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 594, 650);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		lblBuscar = new JLabel("Buscar:");
		lblBuscar.setBounds(10, 11, 58, 14);
		contentPane.add(lblBuscar);
		
		
	
		
		
		list = new JList();
		list.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				
				/*g_DB = new ConsultaNoticiasPorCategoria();
				String info = "";
				if (b){
					info = g_DB.infoArtista(ArrayArtista.get(list.getSelectedIndex()).getId());
					textPane.setText(info);
				}else{
					info = g_DB.infoAlbum(ArrayAlbum.get(list.getSelectedIndex()).getId());
					textPane.setText(info);
	
				}
			}*/
		}});
		
		
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		list.setBounds(10, 47, 568, 213);
		contentPane.add(list);
		
		scrollPane = new JScrollPane();
		scrollPane.setViewportBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		scrollPane.setBounds(10, 264, 568, 337);
		contentPane.add(scrollPane);
		
		textPane = new JTextPane();
		textPane.setContentType("text/html");
		textPane.setEditable(false);
		scrollPane.setViewportView(textPane);		
		
		JComboBox comboBox = new JComboBox();
		comboBox.setModel(new DefaultComboBoxModel(new String[] {"Noticia1", "Noticia2", "Noticia3"}));
		comboBox.setBounds(58, 8, 520, 20);
		contentPane.add(comboBox);
	}
}
